Skip to content

Fix Source.offsets with freeze: true#4045

Merged
kddnewton merged 1 commit into
ruby:mainfrom
Earlopain:fix-freeze-offsets
Mar 26, 2026
Merged

Fix Source.offsets with freeze: true#4045
kddnewton merged 1 commit into
ruby:mainfrom
Earlopain:fix-freeze-offsets

Conversation

@Earlopain

Copy link
Copy Markdown
Collaborator

We still need to do it eagerly when the result will be frozen, same as for locations.

Fixes the following error for the added test:

FrozenError: can't modify frozen Prism::ASCIISource: #<Prism::ASCIISource:0x00007ff9d57586f0 @source="1 + 2", @start_line=1, @offsets="\x00\x00\x00\x00">

We still need to do it eagerly when the result will be frozen, same
as for locations.

Fixes the following error for the added test:
> FrozenError: can't modify frozen Prism::ASCIISource: #<Prism::ASCIISource:0x00007ff9d57586f0 @source="1 + 2", @start_line=1, @offsets="\x00\x00\x00\x00">

@kddnewton kddnewton left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for catching that

@kddnewton
kddnewton merged commit fbf7c14 into ruby:main Mar 26, 2026
68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants